package com.glq1218.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glq1218.article.entity.Article;
import com.glq1218.user.entity.User;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 用户表(User)表数据库访问层
 *
 * @author makejava
 * @since 2023-04-10 09:51:43
 */
@Repository
public interface UserMapper extends BaseMapper<User> {

    int addUserRole(@Param("userId") Long userId, @Param("roleList") List<Long> roleList);

    int deleteUserRole(Long userId);

    String getNicknameByUserId(Long userId);

    @MapKey("name")
    List<Map<String, Long>> getUserData();

    @MapKey("date")
    List<Map<String, Long>> getUserAddData();

    int updatePassword(@Param("id") Long id, @Param("newPassword") String newPassword);

    List<Article> queryRentalArticle(Long userId);
}

